import 'package:demo_flutter/library.dart';

class BtnObject {
  String name;
  String toPageByName;
  Map<String, dynamic> params;

  BtnObject(this.name, this.toPageByName, {this.params})
      : assert(name != null && name != '', 'name 必须是非空字符串'),
        assert(toPageByName != null && toPageByName != '',
            'toPageByName 必须是非空字符串');
}

class IndexState implements Cloneable<IndexState> {
  List<BtnObject> btnList = [];

  @override
  IndexState clone() {
    return IndexState();
  }
}

IndexState initState(Map<String, dynamic> args) {
  IndexState state = IndexState();
  BtnObject btn1 = BtnObject('去广告页面', 'ad_page');
  BtnObject btn2 = BtnObject('去主页', 'main_page', params: {'name': '传递个参数试试看'});
  BtnObject btn3 = BtnObject('Sliver家族', 'sliver_test_page',);
  state.btnList.add(btn1);
  state.btnList.add(btn2);
  state.btnList.add(btn3);
  return state;
}
